﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNNspot.LiveChat.DataModel
{
    public class SessionState
    {
        private readonly int _messageId;

        public int LastMessageId
        {
            get
            {
                return Convert.ToInt32(Messages.Count > 0 ? Messages.LastOrDefault().MessageId : _messageId);
            }
        }

        public List<MessageInfo> Messages { get; set; }
        public int SessionId { get; set; }

        public SessionState(List<MessageInfo> messages, int sessionId, int messageId)
        {
            Messages = messages;
            SessionId = sessionId;
            _messageId = messageId;
        }
    }
}
